﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ASKM.Rachao.Model.Extensions
{
    public static class DateTimeExtension
    {

        /// <summary>
        /// Gets the first hour of a datetime
        /// </summary>
        /// <param name="date">DateTime</param>
        /// <returns>DateTime - 00:00:00</returns>
        public static DateTime ToFirstHour(this DateTime date)
        {
            return new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
        }

        /// <summary>
        /// Gets the last hour of a datetime
        /// </summary>
        /// <param name="date">DateTime</param>
        /// <returns>DateTime - 23:59:59</returns>
        public static DateTime ToLastHour(this DateTime date)
        {
            return new DateTime(date.Year, date.Month, date.Day, 23, 59, 59);
        }

    }
}
